package gitee.derumin.lifeissohard.mixin;

import gitee.derumin.lifeissohard.lishhungersystem.LishHungerManager;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.player.PlayerEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(StatusEffect.class)
public abstract class StatusEffectMixin {

    @Redirect(method = "applyUpdateEffect" , at = @At(value = "INVOKE" , target = "Lnet/minecraft/entity/player/PlayerEntity;addExhaustion(F)V"))
    private void replaceAddExhaustion(PlayerEntity player, float exhaustion){
        ((LishHungerManager)(player.getHungerManager())).lostEnergy(5f*exhaustion);
    }

}
